<header class="page-header">
  {{key-value-header
    baseKey=model
    path="vault.cluster.secrets.backend.list"
    mode=mode
    root=root
    showCurrent=true
  }}
  <div class="level">
    <div class="level-left">
      <h1 class="title is-3" data-test-secret-header="true">
        {{#if (eq mode "create") }}
          Create a PKI Role
        {{else if (eq mode 'edit')}}
          Edit PKI Role
        {{else}}
          PKI Role <code>{{model.id}}</code>
        {{/if}}
      </h1>
    </div>
    <div class="level-right">
      <div class="field is-grouped">
        {{#if (eq mode "show") }}
          {{#if (or model.canUpdate model.canDelete)}}
            <div class="control">
              {{#secret-link
                secret=model.id
                mode="edit"
                replace=true
                class="button has-icon-right is-ghost is-compact"
                data-test-edit-link=true
                }}
                Edit role
                {{i-con glyph="chevron-right" size=11}}
              {{/secret-link}}
            </div>
          {{/if}}
            {{#if model.canGenerate}}
          <div class="control">
              {{#secret-link
                mode="credentials"
                secret=model.id
                queryParams=(query-params action="issue")
                class="button has-icon-right is-ghost is-compact"
                data-test-credentials-link=true
              }}
               Generate Certificate
               {{i-con glyph="chevron-right" size=11}}
              {{/secret-link}}
          </div>
            {{/if}}
            {{#if model.canSign}}
          <div class="control">
              {{#secret-link
                mode="credentials"
                secret=model.id
                queryParams=(query-params action="sign")
                class="button has-icon-right is-ghost is-compact"
                data-test-sign-link=true
              }}
                Sign Certificate
                {{i-con glyph="chevron-right" size=11}}
              {{/secret-link}}
          </div>
            {{/if}}
        {{/if}}
      </div>
    </div>
  </div>
</header>

{{#if (or (eq mode 'edit') (eq mode 'create'))}}
  {{partial 'partials/role-pki/form'}}
{{else}}
  {{partial 'partials/role-pki/show'}}
{{/if}}
